package com.rgs.springboot.autoconfig.myimport;

import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.type.AnnotationMetadata;

import java.util.function.Predicate;

/**
 * @author RenGaoshuai
 * @date 2024/6/18 10:57
 * @description 实现ImportSelector接口的类，Spring会将selectImports放回的全限定类名作为Bean注入spring中
 */
public class MyImportSelector implements ImportSelector {


    /**
     * 该接口返回的全限定类名，注入到spring
     * @param annotationMetadata
     * @return
     */
    @Override
    public String[] selectImports(AnnotationMetadata annotationMetadata) {
        return new String[]{"com.rgs.springboot.autoconfig.domain.AutoStudent"};
    }

    /**
     * 过滤某些类
     * @return
     */
    @Override
    public Predicate<String> getExclusionFilter() {
        return ImportSelector.super.getExclusionFilter();
    }
}
